package com.itheima.article.feign;

import com.itheima.article.dto.ArticleInfoDto;
import com.itheima.article.pojo.ApAuthor;
import com.itheima.common.vo.ResultVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "leadnews-article",contextId = "articleApAuthorFeign")
public interface ArticleApAuthorFeign {

    /**
     * 通过远程调用UserId和wmUserId查询作者信息
     * @param userId ，wmUserId
     * @return
     */
    @GetMapping("/api/apAuthor/getByApUserIdWmUserId/{userId}/{wmUserId}")
    ResultVo<ApAuthor> getByApUserIdWmUserId(@PathVariable("userId") long userId,@PathVariable("wmUserId") long wmUserId);

    /**
     * 通过远程调用添加作者信息
     * @param apAuthor
     * @return
     */
    @PostMapping("/api/apAuthor/add")
    ResultVo<ApAuthor> add(@RequestBody ApAuthor apAuthor);


    /**
     * 同步自媒体文章到文章微服
     * @param dto
     * @return
     */
    @PostMapping("/api/apArticle/saveArticleInfo")
    ResultVo saveArticleInfo(@RequestBody ArticleInfoDto dto);

}
